package com.newcapec.modules.iot.controller;

import com.newcapec.modules.iot.service.IotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/iot")
public class IOTController {

 /*   String loginurl = "https://thingslink.59wanmei.com/api/auth/login";
    String username = "shijianjiaoxue@newcapec.net";
    String password = "Gaimima111";*/
    @Value("${iot.baseUrl}")
    private String iotBaseUrl;
    @Value("${iot.authUrl}")
    private String authUrl;
    @Value("${iot.authUrl}")
    private String username;
    @Value("${iot.password}")
    private String password;


    @Autowired
    private IotService iotService;
    @GetMapping("/auth")
    public String authIotToken() throws Exception {
        return iotService.mkHeaderFromIOT(iotBaseUrl+authUrl,username,password);
    }

}
